#include<stdio.h>
#include<time.h>
#include<stdlib.h>

extern void CalcFloatDemo(float *pData, int count, 
		float *pMax, float *pMin, float *pSum, float *pAverage);
/*
void CalcFloatDemo(float *pData, int count, float *pMax, float *pMin, float *pSum, float *pAverage)
{
	float fmax;
	float fmin;

	fmax = pData[0];
	fmin = pData[0];

	if (pData[1] > fmax)
	{
		fmax = pData[1];
	}
	else if (pData[1] < fmin)
	{
		fmin = pData[1];
	}
}*/


int main(void)
{
	float a[10];
	int i;

	float fmax, fmin, fsum, favergae;

	srand((unsigned int)time(NULL));
	for (i = 0; i < 10; i++)
	{
		a[i] = (rand() % 10000) * 1.0 / (rand() % 100 + 1);
	}
	for (i = 0; i < 10; i++)
	{
		printf("%.2f ", a[i]);
	}
	printf("\n");

	CalcFloatDemo(a, 10, &fmax, &fmin, &fsum, &favergae);
	printf("max: %.2f, min: %.2f, sum: %.2f, average: %.2f\n", 
			fmax, fmin, fsum, favergae);

	return 0;
}
